#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
using namespace std;

class Complex {
public:
    Complex(int a = 0, int b = 0) : a(a), b(b) {};
    Complex(const Complex &obj) : a(obj.a), b(obj.b) {};
    Complex operator+(const Complex &) const;
    Complex operator-(const Complex &) const;
    Complex operator*(const Complex &) const;
    Complex operator/(const Complex &) const;
//    Complex operator+(const Complex &obj) {
//        return Complex((a * obj.a) - (b * obj.b), (b * obj.a) + (a, obj.b));
//    }
    void operator=(const Complex &);
    friend ostream &operator<<(ostream &, const Complex &);
private:
    int a, b;
};

Complex Complex::operator+(const Complex &obj) const {
    return Complex(a + obj.a, b + obj.b);
}

Complex Complex::operator-(const Complex &obj) const {
    return Complex(a - obj.a, b - obj.b);
}

Complex Complex::operator*(const Complex &obj) const {
    return Complex((a * obj.a) - (b * obj.b), (b * obj.a) + (a, obj.b));
}

Complex Complex::operator/(const Complex &obj) const {
    int c = obj.a;
    int d = obj.b;
    long long temp_a = (a * c + b * d) / (c * c + d * d);
    long long temp_b = ((b * c - a * d) / (c * c + d * d));
    return Complex(temp_a, temp_b);
}

void Complex::operator=(const Complex &obj) {
    a = obj.a;
    b = obj.b;
}

ostream &operator<<(ostream &out, const Complex &com) {
    out << com.a << "+" << com.b << "i";
    return out;
}

int main() {
    Complex com1(1, 1);
    Complex com2(2, 2);
    cout << com1 << endl;
    cout << com2 << endl;
    cout << "com1 + com2 : " << (com1 + com2) << endl;
    cout << "com1 - com2 : " << (com2 - com1) << endl;
    cout << "com1 * com2 : " << (com1 * com2) << endl;
    cout << "com1 / com2 : " << (com2 / com1) << endl;
    Complex com3 = com2;
    cout << com3 << endl;
    Complex com4;
    com4 = com2;
    cout << com4;

    return 0;
}
